// 适用于用户管理模块的接口封装管理
import axios from './axios'

export const login=(form)=>{
    return axios.request({
        url:'/user/login',
        method:'post',
        data:form
    })
}

export const queryById=(id)=>{
    return axios.request({
        url:'/user/queryById'+'?id='+id,
        method:'post',
    })
}
// 需要有用户验证，传过去的参数是手机号，发送短信注册，
export const getCode=()=>{

}
//验证一下
export const confirmCode=()=>{

}
export const test=()=>{
    return axios.request({
        url:'/user/test',
        method:'post',
    
    })
}
// 用户修改密码
export const changePassword=(id,password)=>{
    return axios.request({
        url:'/user/changePassword?id='+id+'&password='+password,
        method:'post',
    })
}

export const update=(userData)=>{
    return axios.request({
        url:'/user/update',
        method:'post',
        data:userData
    })
}

// 注册
export const userRegister=(user)=>{
    return axios.request({
        url:'/user/register',
        method:'post',
        data:user
    })
}
// 加入课程
export const joinCourse=(courseId,id,studentId)=>{
    return axios.request({
        url:'/studentCourse/add'+'?courseId='+courseId+'&id='+id+'&studentId='+studentId,
        method:'post',
    })
}
// 通过学生id查询选课记录
export const queryByStudentId=(id)=>{
    return axios.request({
        url:'/studentCourse/queryByStudentId'+'?id='+id,
        method:'post'
    })
}
//获取邮箱验证码
export const generate=(key,email)=>{
    return axios.request({
        url:'/user/generate?email='+email+'&key='+key,
        method:'post'
    })
}
//获取手机验证码
export const sendSms=(tel)=>{
    return axios.request({
        url:'/user/generate?tel='+tel,
        method:'post'
    })   
}
//验证验证码
export const verification=(key,code)=>{
    return axios.request({
        url:'/user/verification?key='+key+'&code='+code,
        method:'post'
    })
}
//通过验证码 重置密码
export const resetPassword=(key,code,password)=>{
    return axios.request({
        url:'/user/resetPassword?key='+key+'&code='+code+'&password='+password,
        method:'post'
    })
}
//是否注册过了

export const isRegister=(tel)=>{
    return axios.request({
        url:'/user/isRegister?tel='+tel,
        method:'post'
    })
}
//注册时候手机号验证
export const registerVerification=(key,code)=>{
    return axios.request({
        url:'/user/registerVerification?key='+key+'&code='+code,
        method:'post'
    })
}